package com.ruoyi.web.controller.kiku;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.kiku.domain.KikuWeiboTrumpetDetail;
import com.ruoyi.kiku.service.IKikuWeiboTrumpetDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 微博小号详情Controller
 *
 * @author TT
 * @date 2025-03-04
 */
@RestController
@RequestMapping("/kiku/weiboTrumpetDetail")
public class KikuWeiboTrumpetDetailController extends BaseController
{
    @Autowired
    private IKikuWeiboTrumpetDetailService kikuWeiboTrumpetDetailService;

    /**
     * 查询微博小号详情列表
     */
    @PreAuthorize("@ss.hasPermi('kiku:weiboTrumpetDetail:list')")
    @GetMapping("/list")
    public TableDataInfo list(KikuWeiboTrumpetDetail kikuWeiboTrumpetDetail)
    {
        startPage();
        List<KikuWeiboTrumpetDetail> list = kikuWeiboTrumpetDetailService.selectKikuWeiboTrumpetDetailList(kikuWeiboTrumpetDetail);
        return getDataTable(list);
    }

    /**
     * 导出微博小号详情列表
     */
    @PreAuthorize("@ss.hasPermi('kiku:weiboTrumpetDetail:export')")
    @Log(title = "微博小号详情", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, KikuWeiboTrumpetDetail kikuWeiboTrumpetDetail)
    {
        List<KikuWeiboTrumpetDetail> list = kikuWeiboTrumpetDetailService.selectKikuWeiboTrumpetDetailList(kikuWeiboTrumpetDetail);
        ExcelUtil<KikuWeiboTrumpetDetail> util = new ExcelUtil<KikuWeiboTrumpetDetail>(KikuWeiboTrumpetDetail.class);
        util.exportExcel(response, list, "微博小号详情数据");
    }

    /**
     * 获取微博小号详情详细信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:weiboTrumpetDetail:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(kikuWeiboTrumpetDetailService.selectKikuWeiboTrumpetDetailById(id));
    }

    /**
     * 新增微博小号详情
     */
    @PreAuthorize("@ss.hasPermi('kiku:weiboTrumpetDetail:add')")
    @Log(title = "微博小号详情", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody KikuWeiboTrumpetDetail kikuWeiboTrumpetDetail)
    {
        return toAjax(kikuWeiboTrumpetDetailService.insertKikuWeiboTrumpetDetail(kikuWeiboTrumpetDetail));
    }

    /**
     * 修改微博小号详情
     */
    @PreAuthorize("@ss.hasPermi('kiku:weiboTrumpetDetail:edit')")
    @Log(title = "微博小号详情", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody KikuWeiboTrumpetDetail kikuWeiboTrumpetDetail)
    {
        return toAjax(kikuWeiboTrumpetDetailService.updateKikuWeiboTrumpetDetail(kikuWeiboTrumpetDetail));
    }

    /**
     * 删除微博小号详情
     */
    @PreAuthorize("@ss.hasPermi('kiku:weiboTrumpetDetail:remove')")
    @Log(title = "微博小号详情", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(kikuWeiboTrumpetDetailService.deleteKikuWeiboTrumpetDetailByIds(ids));
    }
}
